<template>
  <div class="app-container">
    <div class="home">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="骗审页">
          <el-radio-group v-model="form.examineType">
            <el-radio :label="1">开启</el-radio>
            <el-radio :label="0">关闭</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="原价格">
          <el-input v-model="form.costPrise" style="width: 150px"></el-input>
        </el-form-item>

        <el-form-item label="活动价">
          <el-input v-model="form.retailPrise" style="width: 150px"></el-input>
        </el-form-item>

        <el-form-item label="accesskey">
          <el-input v-model="form.appKey" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">确定</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import {
  getNameAllocation,
  updateNameAllocation,
} from "@/api/smallroutine/alipay/nameAllocation";

export default {
  name: "NamesIndex",
  data() {
    return {
      form: {
        examineType: "",
        costPrise: "",
        retailPrise: "",
        appKey: "",
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    onSubmit() {
      console.log("submit!", this.form);
      updateNameAllocation(this.form)
        .then((result) => {})
        .catch((err) => {});
    },
    getList() {
      const id = 1;
      getNameAllocation(id)
        .then((result) => {
          console.log("result", result);
          this.form = result.data;
        })
        .catch((err) => {});
    },
  },
};
</script>
